//
//  DVShoppingViewModel.m
//  LoveFreshBee
//
//  Created by 松鼠君 on 17/10/2016.
//  Copyright © 2016 王忠迪. All rights reserved.
//

#import "DVShoppingViewModel.h"
#import "DVShoppingModel.h"
#import "YYModel.h"
@implementation DVShoppingViewModel
+(instancetype)shared{
    
    static id instance;
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
        instance = [DVShoppingViewModel new];
        
    });
    
    return instance;
    
    
}



//懒加载
-(DVShoppingModel*)shoppingModel{
    
    if (_shoppingModel == nil) {
        
        NSString* path = [[NSBundle mainBundle]pathForResource:@"Shopping.json" ofType:nil];
        
        NSData* data = [NSData dataWithContentsOfFile:path];
        
        id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
        
        _shoppingModel = [DVShoppingModel new];
        
        [_shoppingModel yy_modelSetWithJSON:json];
    }
    
    return _shoppingModel;
    
}


@end
